# coding: utf8
__author__ = 'TonyGuo'


from random import *
from umeng_tool.analyse import consts


def random_str(length, char_map=consts.CDKEY_CHAR_MAP):
    """
    生成指定长度的随机字串
    :param length: <int: 字串长度>
    :param char_map: <str: 字串码表>
    :return: <str: 随机字串>
    """
    return ''.join([choice(char_map) for i in range(length)])
